<#macro layout>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/styles/stylesheet.css?${date?string.computer}" type="text/css">
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript"  src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="/js/swfobject.js" ></script> 
<script type="text/javascript" src="/js/pinjitsu.js" ></script>
 <script type="text/javascript">
    $(document).ready(function()  {
  	var profile = ${restClientService.getMyProfile(accessToken)};
    $("#firstName").html("hello "+ profile.first_name + ", welcome to Pinjitsu");
    
    var friends = ${restClientService.getFriends(accessToken)};
    
    jQuery.each(friends.data, function(index, itemData)
    {
    		jQuery.getJSON('/highscores/'+itemData.id, function(data){
    			if(data != 'null' && data != 'undefined' && data != '' && data != null)
    			{    				
    				$('.friendScores ul').append('<li class="shadow"><img class="profilePicture" src="https://graph.facebook.com/' + itemData.id + '/picture" /><div class="highscore"><p style="margin:0;">'+ itemData.name + '</p><p>' + data+'</p></div></li>');
    			}
    		});
    });

  });
</script>





</head>
<body>
<div id="fb-root">

</div>
<div id="firstName" class="header">

</div>

<#nested />


<script>
  window.fbAsyncInit = function() {
    FB.init({appId: '${appId}', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());
 function invite()
 {
    	FB.ui({method: 'apprequests', message: 'You should learn more about this awesome game.', data: 'tracking information for the user'});
 }
 
</script>
</body>
</html>
</#macro>
